<?php
include_once('../../admin/php/includes/definer.php');
include_once(INC.'admin/php/clases/class.phpmailer.php');

$contenido = '<p><strong>Nombre:</strong> '.htmlentities($_POST['name']).'</p>';
$contenido .= '<p><strong>Email:</strong> '.$_POST['email'].'</p>';
$contenido .= '<p><strong>Tel&eacute;fono:</strong> '.$_POST['phone'].'</p>';
$contenido .= '<p><strong>Consulta:</strong><br />'.nl2br(htmlentities($_POST['comments']));

/*$mail = new PHPMailer();
$mail->PluginDir = 'include/';
$mail->IsSMTP();
$mail->SMTPDebug  = 2;
$mail->Mailer = 'smtp';
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->Username = "marcosfurer@greentomato.com.ar";
$mail->Password = "arpegio5430";
$mail->IsHTML(true);
$mail->From = "marcosfurer@greentomato.com.ar";
$mail->FromName = "Consultas online";
$mail->Timeout = 30;
$mail->AddAddress('maxi@greentomato.com.ar');
$mail->Subject = "Consultas online";
$mail->Body = $contenido;
$exito = $mail->Send();*/

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->PluginDir = "include/";
$mail->Mailer = 'smtp';
$mail->Host = "smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->Username = "contacto@greentomato.com.ar";
$mail->Password = "contacto-gt-2012";
$mail->IsHTML(true);
$mail->From = "contacto@greentomato.com.ar";
$mail->FromName = "Consultas on line";
$mail->Timeout = 30;
$mail->AddAddress('photo@marcosfurer.com.ar');
$mail->Subject = "Consultas on line";
$mail->Body = $contenido;
$exito = $mail->Send();

$intento=1; 
while ((!$exito) && ($intento <= 2)) {
    sleep(3);
    $exito = $mail->Send();
    $intento++;	
}


//$mail->SMTPAuth = true;
//$mail->SMTPSecure = "ssl";

header('location: '.$_SERVER['HTTP_REFERER'].'#success');
?>
